import redis


r = redis.Redis()


r.sadd("武将", "张飞", "关羽", "马超", "周瑜")

r.sadd("文臣", "周瑜", "司马懿", "诸葛亮")

result = r.smembers("武将")
print({i.decode() for i in result})

result = r.sdiff("武将", "文臣")
print({i.decode() for i in result})

result = r.sinter("武将", "文臣")
print({i.decode() for i in result})

result = r.sunion("武将", "文臣")
print({i.decode() for i in result})
